package com.liberation.aidiancan.presenter;

/**
 * 项目名称： AiDianCan
 * 创建人 : Liberation
 * 创建时间: 2016/12/12 10:36
 */


import android.content.Context;
import android.util.Log;

import com.liberation.aidiancan.view.MvpView;
import com.orhanobut.logger.Logger;

import java.lang.ref.WeakReference;


public abstract class BasePresent<V extends MvpView> {

	private WeakReference<V> weakReference;

	//创建连接方法
	public void attch(V v) {
		weakReference = new WeakReference<>(v);
		Logger.e("msg", "attch: 创建连接");
	}

	//断开连接方法
	public void DeAttch(V v) {
		if (weakReference != null) {
			weakReference.clear();
			weakReference = null;
			Log.e("msg", "DeAttch: 断开连接");
		}
	}

	//返回绑定的view
	public V getView() {
		return weakReference.get();
	}
	public abstract void loadData(Context context,String ...args);


}
